<template>
  <home-index></home-index>
</template>

<script>
import homeIndex from './components/home-index.vue';
export default {
    name: 'home',
    components: {
        homeIndex
    },
    data () {
        return {
            scroll: 0
        };
    },
    activated () {
        document.documentElement.scrollTop = this.scroll;
    },
    beforeRouteLeave (to, from, next) {
    // 离开当前组件的时候记录用户滚出去的距离
        this.scroll = window.pageYOffset;
        next();
    }
};
</script>

<style scoped></style>
